/*
 * @Author: szx
 * @Date: 2021-11-25 13:03:47
 * @LastEditTime: 2021-11-25 13:12:59
 * @Description:
 * @FilePath: \leetcode\300-399\343\343.js
 */
/**
 * @param {number} n
 * @return {number}
 */
var integerBreak = function (n) {
    const dp = new Array(n + 1).fill(0);
    dp[1] = 0;
    dp[2] = 1;
    for (let i = 1; i <= n; i++) {
        for (let j = 1; j < i; j++) {
            dp[i] = Math.max((i - j) * j, dp[i]);
            dp[i] = Math.max(dp[i], dp[i - j] * j);
        }
    }
    return dp[n];
};
console.log(integerBreak(10));
